/*   1:    */ package com.atomikos.icatch.imp;
/*   2:    */ 
/*   3:    */ import com.atomikos.icatch.CompositeTransaction;
/*   4:    */ import com.atomikos.icatch.Participant;
/*   5:    */ import com.atomikos.icatch.RecoveryCoordinator;
/*   6:    */ import com.atomikos.icatch.RollbackException;
/*   7:    */ import com.atomikos.icatch.SubTxAwareParticipant;
/*   8:    */ import com.atomikos.icatch.Synchronization;
/*   9:    */ import com.atomikos.icatch.SysException;
/*  10:    */ import com.atomikos.icatch.TxState;
/*  11:    */ 
/*  12:    */ class TxTerminatedStateHandler
/*  13:    */   extends TransactionStateHandler
/*  14:    */ {
/*  15:    */   private boolean commit_;
/*  16:    */   
/*  17:    */   protected TxTerminatedStateHandler(CompositeTransactionImp ct, TransactionStateHandler handler, boolean commit)
/*  18:    */   {
/*  19: 50 */     super(ct, handler);
/*  20: 51 */     this.commit_ = commit;
/*  21:    */   }
/*  22:    */   
/*  23:    */   protected CompositeTransaction createSubTransaction()
/*  24:    */     throws SysException, IllegalStateException
/*  25:    */   {
/*  26: 57 */     throw new IllegalStateException("Transaction no longer active");
/*  27:    */   }
/*  28:    */   
/*  29:    */   protected RecoveryCoordinator addParticipant(Participant participant)
/*  30:    */     throws SysException, IllegalStateException
/*  31:    */   {
/*  32: 68 */     if (!this.commit_) {
/*  33:    */       try
/*  34:    */       {
/*  35: 72 */         participant.rollback();
/*  36:    */       }
/*  37:    */       catch (Exception ignore) {}
/*  38:    */     } else {
/*  39: 78 */       throw new IllegalStateException("Transaction no longer active");
/*  40:    */     }
/*  41: 81 */     return getCT().getCoordinatorImp();
/*  42:    */   }
/*  43:    */   
/*  44:    */   protected void registerSynchronization(Synchronization sync)
/*  45:    */     throws IllegalStateException, UnsupportedOperationException, SysException
/*  46:    */   {
/*  47: 87 */     throw new IllegalStateException("Transaction no longer active");
/*  48:    */   }
/*  49:    */   
/*  50:    */   protected void addSubTxAwareParticipant(SubTxAwareParticipant subtxaware)
/*  51:    */     throws SysException, IllegalStateException
/*  52:    */   {
/*  53: 94 */     if (this.commit_) {
/*  54: 95 */       throw new IllegalStateException("Transaction no longer active");
/*  55:    */     }
/*  56: 99 */     subtxaware.rolledback(getCT());
/*  57:    */   }
/*  58:    */   
/*  59:    */   protected void rollbackWithStateCheck()
/*  60:    */     throws IllegalStateException, SysException
/*  61:    */   {
/*  62:107 */     throw new IllegalStateException("Transaction no longer active");
/*  63:    */   }
/*  64:    */   
/*  65:    */   protected void commit()
/*  66:    */     throws SysException, IllegalStateException, RollbackException
/*  67:    */   {
/*  68:113 */     throw new IllegalStateException("Transaction no longer active");
/*  69:    */   }
/*  70:    */   
/*  71:    */   protected Object getState()
/*  72:    */   {
/*  73:118 */     if (this.commit_) {
/*  74:119 */       return getCT().getCoordinatorImp().getState();
/*  75:    */     }
/*  76:121 */     return TxState.MARKED_ABORT;
/*  77:    */   }
/*  78:    */ }


/* Location:           C:\myfile\mysoft\apache-maven-3.5.0-bin\apache-maven-3.5.0\myrep\com\atomikos\transactions\3.7.0\transactions-3.7.0.jar
 * Qualified Name:     com.atomikos.icatch.imp.TxTerminatedStateHandler
 * JD-Core Version:    0.7.0.1
 */